package main

import (
	"fmt"
	"sync"
	"time"
)

func main1() {
	var wg sync.WaitGroup

	wg.Add(1)

	go func(w sync.WaitGroup) {
		fmt.Println("I am a goroutine")
		time.Sleep(1 * time.Second)
		w.Done()
	}(wg)

	wg.Wait()
	fmt.Println("ok")

}

func main() {
	var wg sync.WaitGroup

	wg.Add(1)

	go func(w *sync.WaitGroup) {
		fmt.Println("I am a goroutine")
		time.Sleep(1 * time.Second)
		w.Done()
	}(&wg)

	wg.Wait()
	fmt.Println("ok")

}
